package org.zhangxiao.paladin2.admin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.zhangxiao.paladin2.admin.cfg.ISysCfgService;
import org.zhangxiao.paladin2.admin.cfg.SystemCfg;

import java.util.Optional;

@RestController("commonSystemInfoCtrl")
public class SystemInfoCtrl {

    @Autowired
    private ISysCfgService sysCfgService;

    @GetMapping("/common/system_info")
    public SystemCfg getCfg() {
        return Optional.ofNullable(sysCfgService.getCfg(SystemCfg.class))
                .orElse(new SystemCfg());
    }
}
